/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control;

import gestion.DBGestionReserva;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import negocio.Reserva;

/**
 *
 * @author David
 */
public class ControlReserva {

    private DBGestionReserva dbgr = new DBGestionReserva();
    private Reserva res;
    ResultSet rs;

    public ControlReserva() {
    }

    public void crearRes(int is, int us) {
        dbgr.crearReserva(us, is);
    }

    public void eliminarRes(int is, int us) {
        dbgr.eliminarReserva(us, is);
    }

    public Reserva bReserva(int is) {
        rs = null;
        res = new Reserva();
        rs = dbgr.bReserva(is);
        try {
            while (rs.next() == true) {
                res.setLibro(rs.getString(1));
                res.setUsuario(rs.getString(2));
                res.setFecha(rs.getDate(3));
            }
        } catch (SQLException ex) {
            Logger.getLogger(ControlReserva.class.getName()).log(Level.SEVERE, null, ex);
        }
        return res;
    }
}
